package com.probiz.estore.common.model.product.base;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.attribute.Attribute;
import com.probiz.estore.common.model.attribute.ProductAttrValue;
import com.probiz.estore.common.model.product.ProductAttGroup;
import com.probiz.estore.core.model.BaseObject;

/**
 * ProductAttGroupItem Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class ProductAttGroupItemTbl extends BaseObject implements Serializable {

    protected Integer productAttGroupItemId;
	protected Integer productTypeId;
	protected Integer sortOrder;
    protected Short showStyle;
    protected String searchValue;
    protected Integer isQuickSearch; //是否开启快速搜索功能
    protected ProductAttGroup productAttGroup;
	protected Attribute attribute;
	protected Set<ProductAttrValue> productAttrValues = new HashSet<ProductAttrValue>();


	/**
	 * Default Empty Constructor for class ProductAttGroupItem
	 */
	public ProductAttGroupItemTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class ProductAttGroupItem
     * @param in_productAttGroupItemId 属性项id
	 */
	public ProductAttGroupItemTbl (Integer in_productAttGroupItemId) {
        this.setProductAttGroupItemId(in_productAttGroupItemId);
    }


    public ProductAttGroup getProductAttGroup() {
        return productAttGroup;
    }

    public void setProductAttGroup(ProductAttGroup productAttGroup) {
        this.productAttGroup = productAttGroup;
    }

    
    public Set<ProductAttrValue> getProductAttrValues() {
		return productAttrValues;
	}

	public void setProductAttrValues(Set<ProductAttrValue> productAttrValues) {
		this.productAttrValues = productAttrValues;
	}

	public Attribute getAttribute() {
        return attribute;
    }

    public void setAttribute(Attribute attribute) {
        this.attribute = attribute;
    }

    public Integer getIsQuickSearch() {
        return isQuickSearch;
    }

    public void setIsQuickSearch(Integer isQuickSearch) {
        this.isQuickSearch = isQuickSearch;
    }

    public Short getShowStyle() {
        return showStyle;
    }

    public void setShowStyle(Short showStyle) {
        this.showStyle = showStyle;
    }

    public String getSearchValue() {
        return searchValue;
    }

    public void setSearchValue(String searchValue) {
        this.searchValue = searchValue;
    }

    /**
	 * 	 * @return Integer
     * @hibernate.id column="productAttGroupItemId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getProductAttGroupItemId() {
		return this.productAttGroupItemId;
	}
	
	/**
	 * Set the productAttGroupItemId
	 */	
	public void setProductAttGroupItemId(Integer aValue) {
		this.productAttGroupItemId = aValue;
	}	

	/**
	 * 	 * @return Integer
	 */
	public Integer getProductAttGroupId() {
		return this.getProductAttGroup()==null?null:this.getProductAttGroup().getProductAttGroupId();
	}
	
	/**
	 * Set the productAttGroupId
	 */	
	public void setProductAttGroupId(Integer aValue) {
	    if (aValue==null) {
	    	productAttGroup = null;
	    }else {
	    	productAttGroup = new com.probiz.estore.common.model.product.ProductAttGroup(aValue);
	        productAttGroup.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 	 * @return Integer
	 */
	public Integer getAttributeId() {
		return this.getAttribute()==null?null:this.getAttribute().getAttributeId();
	}
	
	/**
	 * Set the attributeId
	 */	
	public void setAttributeId(Integer aValue) {
	    if (aValue==null) {
	    	attribute = null;
	    } else {
	    	attribute = new com.probiz.estore.common.model.attribute.Attribute(aValue);
	        attribute.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 冗余字段	 * @return Integer
	 * @hibernate.property column="productTypeId" type="java.lang.Integer" length="10" not-null="true" unique="false"
	 */
	public Integer getProductTypeId() {
		return this.productTypeId;
	}
	
	/**
	 * Set the productTypeId
	 * @spring.validator type="required"
	 */	
	public void setProductTypeId(Integer aValue) {
		this.productTypeId = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="sortOrder" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getSortOrder() {
		return this.sortOrder;
	}
	
	/**
	 * Set the sortOrder
	 */	
	public void setSortOrder(Integer aValue) {
		this.sortOrder = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof ProductAttGroupItemTbl)) {
			return false;
		}
		ProductAttGroupItemTbl rhs = (ProductAttGroupItemTbl) object;
		return new EqualsBuilder()
				.append(this.productAttGroupItemId, rhs.productAttGroupItemId)
								.append(this.productTypeId, rhs.productTypeId)
				.append(this.sortOrder, rhs.sortOrder)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.productAttGroupItemId) 
								.append(this.productTypeId) 
				.append(this.sortOrder) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("productAttGroupItemId", this.productAttGroupItemId) 
								.append("productTypeId", this.productTypeId) 
				.append("sortOrder", this.sortOrder) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "productAttGroupItemId";
	}
	
	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return productAttGroupItemId;
	}

}